<?php
/**
 * @package AMFramework
 * @subpackage Data_Pack
 * @author Marcu Alexandru
 * @version 1.0 $Build 305b  
 */
class Amfw_Html_Document
{
	public static function meta($meta) {
		if(!is_array($meta)) return;
		$html = '';
		foreach($meta as $name => $content) 
		{
			$html .= "\n".'<meta name="'.$name.'" content="'.$content.'" />';
		}
		return $html;
	}
	
	public static function javascript($js, $isCode = false) {
		if(empty($js)) return;
		if($isCode && !is_array($js)) return "\n".'<script type="text/javascript">'.$js.'</script>';
		$html = '';
		if(!is_array($js)) $js = array($js);
		foreach($js as $jsPath) 
		{
			$html .= "\n".'<script type="text/javascript" src="'.$jsPath.'"></script>';
		}
		return $html;
	}
	
	public static function stylesheet($css) {
		if(empty($css)) return;
		if(!is_array($css)) $css = array($css);
		$html = '';
		foreach($css as $cssPath) 
		{
			$html .= "\n".'<link rel="stylesheet" type="text/css" href="'.$cssPath.'"/>';
		}
		return $html;
	}
	
	public static function doctype($doctype = 'xhtml1-transitional') 
	{
		$doctype = empty($doctype) ?  'xhtml1-transitional' : $doctype;

		switch( $doctype ) 
		{
			case 'xhtml1-transitional': 
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" '.
				 		'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
			case 'html5':
				return 	'<!DOCTYPE html>';
			case 'strict':
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" '. 
						'"http://www.w3.org/TR/html4/strict.dtd">';
			case 'loose':
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" '. 
						'"http://www.w3.org/TR/html4/loose.dtd">';
			case 'frameset': 
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" '. 
						'"http://www.w3.org/TR/html4/frameset.dtd">';
			case 'xhtml1-strict': 
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 
						'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
			case 'xhtml1-frameset': 
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" '. 
						'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
			case 'xhtml11': 
				return 	'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" '. 
						'"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
		}
		return '';
	}
}